package com.yhsimon.feign;

import com.yhsimon.entity.AdviceVO;
import com.yhsimon.entity.User;
import com.yhsimon.entity.UserVO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;


@FeignClient(value = "user") //与user子模块映射
public interface UserFeign {
    @GetMapping("/user/findAll/{page}/{limit}")
    public UserVO findAll(@PathVariable("page") int page, @PathVariable("limit") int limit);

    @GetMapping("/user/findById/{id}")
    public User findById(@PathVariable("id") int id);

    @DeleteMapping("/user/deleteById/{id}")
    public void deleteBytId(@PathVariable("id") int id);

    @DeleteMapping("/user/deleteAdviceById/{id}")
    public void deleteAdviceById(@PathVariable("id") int id);

    @PutMapping("/user/update")
    void update(@RequestBody User user);

    @PostMapping(value = "/user/save")
    public void save(@RequestBody User user);

    @PostMapping(value = "/user/advice/{id}/{advice}")
    void advice(@PathVariable("id") int id,@PathVariable("advice") String advice);

    @GetMapping("/user/findAllAdvice/{page}/{limit}")
    AdviceVO findAllAdvice(@PathVariable("page") int page, @PathVariable("limit") int limit);

    @GetMapping("/user/findByName/{userName}")
    User findByName(@PathVariable("userName") String userName);
}
